package edu.zhku.myio;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class MyRead {
	public static void main(String[] args){
		FileInputStream fis = null;
		InputStreamReader isr = null;
		try{
			fis = new FileInputStream("E:\\test.txt");
			isr = new InputStreamReader(fis);
			char[] buffer = new char[12];
			while(true){
				int len = isr.read(buffer);
				if (-1 == len){
					break;
				}
				String str = new String(buffer, 0, len);
				System.out.println(str);
			}
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try{
				fis.close();
			}catch(IOException e){
				e.printStackTrace();
			}
			try{
				isr.close();
			}catch(IOException e) {
				e.printStackTrace();
			}
		}
	}
}
